package org.backend.repository;

import org.backend.mapper.AddressMapper;
import org.backend.pojo.entity.Address;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class AddressRepository {
    @Autowired
    private AddressMapper addressMapper;

    public int add(Address address) {
        return addressMapper.add(address);
    }

    public int update(Address address) {
        return addressMapper.update(address);
    }

    public List<Address> getAddress(String openid, Integer userId) {
        return addressMapper.getAddress(openid, userId);
    }

    public Address getAddressById(Integer id) {
        return addressMapper.getAddressById(id);
    }

    public void updateDefault() {
        addressMapper.updateDefault();
    }

    public Address getDefaultAddress(String openid, Integer userId) {
        return addressMapper.getDefaultAddress(openid, userId);
    }
}
